/*    */ package com.wgcloud.service;
/*    */ 
/*    */ import com.github.pagehelper.PageHelper;
/*    */ import com.github.pagehelper.PageInfo;
/*    */ import com.wgcloud.entity.DceInfo;
/*    */ import com.wgcloud.mapper.DceInfoMapper;
/*    */ import com.wgcloud.util.DateUtil;
/*    */ import com.wgcloud.util.UUIDUtil;
/*    */ import java.util.Date;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ import org.apache.commons.lang3.StringUtils;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.stereotype.Service;
/*    */ import org.springframework.transaction.annotation.Transactional;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ @Service
/*    */ public class DceInfoService
/*    */ {
/*    */   @Autowired
/*    */   private DceInfoMapper dceInfoMapper;
/*    */   
/*    */   public PageInfo selectByParams(Map<String, Object> params, int currPage, int pageSize) throws Exception {
/* 30 */     PageHelper.startPage(currPage, pageSize);
/* 31 */     List<DceInfo> list = this.dceInfoMapper.selectByParams(params);
/* 32 */     PageInfo<DceInfo> pageInfo = new PageInfo(list);
/* 33 */     return pageInfo;
/*    */   }
/*    */   
/*    */   public void save(DceInfo dceInfo) throws Exception {
/* 37 */     dceInfo.setId(UUIDUtil.getUUID());
/* 38 */     dceInfo.setResTimes(Integer.valueOf(0));
/* 39 */     dceInfo.setCreateTime(DateUtil.getNowTime());
/* 40 */     if (StringUtils.isEmpty(dceInfo.getHostname())) {
/* 41 */       dceInfo.setHostname(dceInfo.getHostname().trim());
/*    */     }
/* 43 */     this.dceInfoMapper.save(dceInfo);
/*    */   }
/*    */ 
/*    */   
/*    */   @Transactional
/*    */   public void saveRecord(List<DceInfo> recordList) throws Exception {
/* 49 */     if (recordList.size() < 1) {
/*    */       return;
/*    */     }
/* 52 */     Date now = DateUtil.getNowTime();
/* 53 */     for (DceInfo as : recordList) {
/* 54 */       as.setResTimes(Integer.valueOf(0));
/* 55 */       as.setId(UUIDUtil.getUUID());
/* 56 */       as.setCreateTime(now);
/*    */     } 
/* 58 */     this.dceInfoMapper.insertList(recordList);
/*    */   }
/*    */   
/*    */   public int countByParams(Map<String, Object> params) throws Exception {
/* 62 */     return this.dceInfoMapper.countByParams(params);
/*    */   }
/*    */   
/*    */   @Transactional
/*    */   public int deleteById(String[] id) throws Exception {
/* 67 */     return this.dceInfoMapper.deleteById(id);
/*    */   }
/*    */ 
/*    */   
/*    */   public void updateById(DceInfo dceInfo) throws Exception {
/* 72 */     if (StringUtils.isEmpty(dceInfo.getHostname())) {
/* 73 */       dceInfo.setHostname(dceInfo.getHostname().trim());
/*    */     }
/* 75 */     this.dceInfoMapper.updateById(dceInfo);
/*    */   }
/*    */   
/*    */   public DceInfo selectById(String id) throws Exception {
/* 79 */     return this.dceInfoMapper.selectById(id);
/*    */   }
/*    */   
/*    */   @Transactional
/*    */   public void updateRecord(List<DceInfo> recordList) throws Exception {
/* 84 */     this.dceInfoMapper.updateList(recordList);
/*    */   }
/*    */   
/*    */   public List<DceInfo> selectAllByParams(Map<String, Object> params) throws Exception {
/* 88 */     return this.dceInfoMapper.selectAllByParams(params);
/*    */   }
/*    */ }


/* Location:              /Users/zhangyongxin/soft-install/wgcloud/wgcloud-v3.3.5/server/bank/wgcloud-server-release.jar!/BOOT-INF/classes/com/wgcloud/service/DceInfoService.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */